CallGraph
uisettingsdlg.cpp
Go to the documentation of this file.
00001 #include "imanager.h"
00002 #include "callgraph.h"
00003 #include "uisettingsdlg.h"
00004 #include <wx/filedlg.h>
00005 
00006 uisettingsdlg::uisettingsdlg( wxWindow* parent, IManager *mgr)//, CallGraph *plugin )
00007                 : uisettings(parent)
00008                 , m_mgr(mgr)
00009                 //, m_mplugin(plugin)
00010 {
00011         //ConfCallGraph confData;
00012         // read last stored value for paths gprof and dot
00013         m_mgr->GetConfigTool()->ReadObject(wxT("CallGraph"), &confData);
00014         m_textCtrl_path_gprof->SetValue(confData.GetGprofPath());
00015         m_textCtrl_path_dot->SetValue(confData.GetDotPath());
00016         m_spinCtrl_treshold_edge->SetValue(confData.GetTresholdEdge());
00017         m_spinCtrl_treshold_node->SetValue(confData.GetTresholdNode());
00018         m_spinCtrl_colors_node->SetValue(confData.GetColorsNode());
00019         m_spinCtrl_colors_edge->SetValue(confData.GetColorsEdge());
00020         m_checkBox_Names->SetValue(confData.GetBoxName());
00021         m_checkBox_Parametrs->SetValue(confData.GetBoxParam());
00022         //
00023         if(m_checkBox_Names->IsChecked()) m_checkBox_Parametrs->Disable();
00024         if(m_checkBox_Parametrs->IsChecked()) m_checkBox_Names->Disable();
00025         //
00026         
00027 }
00028 
00029 void uisettingsdlg::OnButton_click_select_gprof( wxCommandEvent& event )
00030 {
00031         wxUnusedVar(event);
00032         wxString new_gprof_path = wxFileSelector(_("Select gprof..."), m_textCtrl_path_gprof->GetValue().c_str(), wxT(""), wxT(""), wxFileSelectorDefaultWildcardStr, 0, this);
00033         if (!new_gprof_path.IsEmpty())
00034         {
00035                 m_textCtrl_path_gprof->SetValue(new_gprof_path);
00036         }
00037 }
00038 
00039 void uisettingsdlg::OnButton_click_select_dot( wxCommandEvent& event )
00040 {
00041         wxUnusedVar(event);
00042         wxString new_dot_path = wxFileSelector(_("Select dot..."), m_textCtrl_path_dot->GetValue().c_str(), wxT(""), wxT(""), wxFileSelectorDefaultWildcardStr, 0, this);
00043         if (!new_dot_path.IsEmpty())
00044         {
00045                 m_textCtrl_path_dot->SetValue(new_dot_path);
00046         }
00047 }
00048 
00049 void uisettingsdlg::OnButton_click_ok( wxCommandEvent& event )
00050 {
00051         wxUnusedVar(event);
00052         // store values
00053         //ConfCallGraph confData;
00054         confData.SetGprofPath(m_textCtrl_path_gprof->GetValue());
00055         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00056         //
00057         confData.SetDotPath(m_textCtrl_path_dot->GetValue());
00058         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00059         //
00060         confData.SetTresholdNode(m_spinCtrl_treshold_node->GetValue());
00061         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00062         //
00063         confData.SetTresholdEdge(m_spinCtrl_treshold_edge->GetValue());
00064         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00065         //
00066         confData.SetColorsEdge(m_spinCtrl_colors_edge->GetValue());
00067         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00068         //
00069         confData.SetColorsNode(m_spinCtrl_colors_node->GetValue());
00070         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00071         
00072         confData.SetBoxName(m_checkBox_Names->GetValue());
00073         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00074         
00075         confData.SetBoxParam(m_checkBox_Parametrs->GetValue());
00076         m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
00077         
00078         
00079         if ((wxFileExists(m_textCtrl_path_gprof->GetValue())) && (wxFileExists(m_textCtrl_path_dot->GetValue())))
00080         {
00081                 EndModal(wxID_OK);
00082         }
00083         else
00084         {
00085                 wxMessageBox(wxT("Please check settings for plugin."), wxT("CallGraph"), wxOK | wxICON_INFORMATION);
00086         }
00087         
00088         //event.Skip();
00089 }
00090 
00091 void uisettingsdlg::OnButton_click_cancel( wxCommandEvent& event )
00092 {
00093         wxUnusedVar(event);
00094         EndModal(wxID_CANCEL);
00095 }
00096 
00097 void uisettingsdlg::OnCheckName(wxCommandEvent& event)
00098 {
00099         if(m_checkBox_Names->IsChecked())
00100                 m_checkBox_Parametrs->Disable();
00101                 else m_checkBox_Parametrs->Enable();
00102 }
00103 
00104 void uisettingsdlg::OnCheckParam(wxCommandEvent& event)
00105 {
00106         if(m_checkBox_Parametrs->IsChecked())
00107                 m_checkBox_Names->Disable();
00108                 else m_checkBox_Names->Enable();
00109 }
 All Classes Files Functions Variables